package com.yukh.test.javabase.collection.map;

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;

@SuppressWarnings("all")
public class HashTableDemo {
	
	
	public static void main(String[] args) {
		Hashtable ht = new Hashtable();
		ht.put("1", "2");
		ht.put("2", "2");
		ht.put("3", "2");
		ht.put("4", "2");
		
		Iterator it1 = ht.entrySet().iterator();
		while(it1.hasNext()){
			 Map.Entry me = (Map.Entry)it1.next();
			 System.out.println(me.getKey() + "="+me.getValue());
		}
		
	    Enumeration e = ht.keys();
	    while(e.hasMoreElements()){
	    	String key = (String)e.nextElement();
	    	System.out.println(key);
	    }
		
	    Iterator it = ht.keySet().iterator();
	    while(it.hasNext()){
	    	String key = (String)it.next();
	    	System.out.println(key);
	    }
	}
}
